<?php
/**
 * Created by PhpStorm.
 * User: Dinh Thi
 * Date: 2/25/15
 * Time: 6:07 PM
 */

namespace MyApp\Application\Controller;


use DinhThi\MVC\Request;
use MyApp\Application\Model\HoaDonModel;

class PrintController extends MyAppAbstractController{
    public function __construct(){
        parent::__construct();
        parent::mustBeLogin();

        $this->view->SoDienThoai = '...';
        $this->view->DiaChi = '...';
    }

    public function HoaDonBanHangAction(){
        $request = Request::getInstance();
        if (isset ($request->getParams()[2])){
            $id = $request->getParams()[2];
            $model = new HoaDonModel();

            $data = $model->ChiTietHoaDon($id);
            $info = $model->ThongTinChiTietHoaDon($id);

            $this->view->info = $info;
            $this->view->data = $data;
            $this->view->render('Print/hoa-don', true);
        }
    }

    public function GiaoHangAction(){
        $request = Request::getInstance();
        if (isset ($request->getParams()[2])){
            $id = $request->getParams()[2];
            $model = new HoaDonModel();

            $data = $model->ChiTietHoaDon($id);
            $info = $model->ThongTinChiTietHoaDon($id);

            $this->view->info = $info;
            $this->view->data = $data;
            $this->view->render('Print/giao-hang', true);
        }
    }
} 